<?php
namespace app\admin\validate;
use yzh52521\validate\Validate;

class GoodsValidate extends validate{

	/**
	 *@description 验证器规则
	 *@buildcode(true)
	*/
	protected $rule = [
		'goods_name'=>['require'],
		'sale_price'=>['regex'=>'/(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/'],
	];

	/**
	 *@description 错误提示
	 *@buildcode(true)
	*/
	protected $message = [
		'goods_name.require'=>'商品名称不能为空',
		'sale_price.regex'=>'销售价格式错误',
	];

	/**
	 *@description 验证场景
	 *@buildcode(true)
	*/
	protected $scene  = [
		'add'=>['goods_name','sale_price'],
		'update'=>['goods_name','sale_price'],
	];



}